package com.shareinfo.permission.dao.impl.mybatis;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import org.springframework.stereotype.Repository;
import com.shareinfo.framework.utils.EasyTreeUtils;
import com.shareinfo.framework.dao.impl.BaseIbatis3Dao;
import com.shareinfo.permission.dao.IUserDeptDao;
import com.shareinfo.permission.model.UserDept;
import com.shareinfo.permission.query.UserDeptQuery;

@Repository("userDeptDao")
public class UserDeptDao extends BaseIbatis3Dao<UserDept, String> implements IUserDeptDao
{
	public Integer selectChildCount(List<String> list)
	{
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("child", "true");
		map.put("list", list);

		return selectCount(map);
	}

	public JSONArray selectTreeList(UserDeptQuery query)
	{
		List<UserDept> list = selectList(query, null);
		return EasyTreeUtils.listToTree(list, false);
	}

	public Class getEntityClass()
	{
		return UserDept.class;
	}
}